package com.asset.dispoal.address.service;

import com.asset.dispoal.address.api.AreaService;
import com.asset.dispoal.address.dto.AreaRequest;
import com.asset.dispoal.address.service.commom.AreaDeleteCommand;
import com.asset.dispoal.address.service.commom.AreaInsertCommand;
import com.asset.dispoal.address.service.commom.AreaQueryAllCommand;
import com.asset.dispoal.address.service.commom.AreaUpdateCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.mhuang.pacebox.springboot.protocol.Result;

@Service
public class AreaServiceImpl implements AreaService {

    @Autowired
    private AreaQueryAllCommand areaQueryAllCommand;

    @Autowired
    private AreaInsertCommand areaInsertCommand;

    @Autowired
    private AreaUpdateCommand areaUpdateCommand;

    @Autowired
    private AreaDeleteCommand areaDeleteCommand;

    @Override
    public Result queryAll() {
        return areaQueryAllCommand.execute();
    }

    @Override
    public Result insert(AreaRequest area) {
        return areaInsertCommand.execute(area);
    }

    @Override
    public Result update(AreaRequest area) {
        return areaUpdateCommand.execute(area);
    }

    @Override
    public Result delete(String id) {
        return areaDeleteCommand.execute(id);
    }
}
